{use master_page('admin/v_master')} 

{block content}



<?php $ci = &get_instance(); 
function bl_class($children,$level=1)
{
	$ci = & get_instance();
	foreach($children as $child)
	{
		$title = $child->title;
		$pad = "";
		for($i=0;$i<$level-1;$i++)
		{
			$pad = $pad . "----";
		}
		if($level == 1){
		$pad="+";
		}
		// $title = str_pad($title,'-',strlen($title)+level,STR_PAD_LEFT);

		echo "<option value='".$child->id."'>$pad$title</option>" ;
		if(sizeof($child->children)>0)
		{
			bl_class($child->children,$level+1);
		}
	}
}
?>


<div class="line"> 

<form action="<?=$_SERVER['REQUEST_URI']?>" method="post">
<div class="blank20" style="height:20px"></div>
	<div id="tagscontent" class="right_box">
	<table class="formtable" style="border:0px solid #cfcfcf;width:100%">
		<tr class='form_line'>
			<td class='title' style="text-align:right;width:15%"><?=lang('page_title')?></td>
			<td class='content'>
				<input name='p_title' size='48' value='<?=set_value('p_title', $title)?>' type='text' />  
				<?=form_error('p_title', '<font color="red">', '</font>')?>  
			</td>
		</tr>
		<tr class='form_line'>
			<td class='title'><?=lang('page_alias')?></td>
			<td class='content'>
				<input name='p_alias' size='48' value='<?=set_value('p_alias', $alias)?>' type='text' />  
				<?=form_error('p_alias', '<font color="red">', '</font>')?>  
			</td>
		</tr> 
		<tr class='form_line'>
			<td class='title'><?=lang('page_content')?></td> 
			<td class='content'>
				<textarea name='p_content' id='content'
				style = 'height:460px;width:588px'><?=set_value('p_content', $content)?></textarea>  
				<?=form_error('p_content', '<font color="red">', '</font>')?>   
			</td>
		</tr>
		
		<?$cls = $this->page_class_manager->get($this->input->get('class_id'));?>
		<?$children = 
			!empty($_GET['class_id'])?$cls->children:$this->page_class_manager->get_root_list();?>
		<?if(sizeof($children)>0):?>
		<tr class='form_line'> 
			<td class='title'><?=lang('page_class')?></td>
			<td class='content'>
				
				<select id = 'class_id' class='bind'>
					<?php if(!empty($_GET['class_id'])):?>
					<option value='{cls->id}'>{cls->title}</option>  
					<?php endif;?>
					<?php bl_class($children,1)?>
				</select>  
				<input name='p_class_id' value='<?=set_value('p_class_id', $class_id)?>' type='hidden' />   
				<?=form_error('p_class_id', '<font color="red">', '</font>')?>   
			</td>
		</tr>
		<?else:?>
		<input name='p_class_id' value='<?=set_value('p_class_id', $class_id)?>' type='hidden' /> 
		<?endif;?>
		
		<tr class='form_line'>
			<td class='title'><?=lang('page_part_template')?></td>
			<td class='content'>
				<select id="part_template" class="bind">
					<option value="">请选择</option>
					<?php foreach($part_templates as $pt):?> 
					<option value="{pt}">{pt}</option> 
					<?php endforeach;?>
				</select>
				<input name='p_part_template' value='<?=set_value('p_part_template', $part_template)?>' type='hidden' />  
				<?=form_error('p_part_template', '<font color="red">', '</font>')?>   
			</td>
		</tr> 
	</table>
	<div class="blank20"style="height:20px"></div>
	<input type="submit" name="submit" value=" 提交 " class="btn_a">
</div> 
</form>
</div>

<script>
var editor;
KindEditor.ready(function(K) {
	editor = K.create('#content',{allowFileManager : true}) ;      
});
</script>

{end}



